#ifndef D20MODEL_H
#define D20MODEL_H

#include "d20_global.h"


#include <ItemModel.h>
#include <QDebug>


class D20SHARED_EXPORT D20Model : public ItemModel
{
    Q_OBJECT

public:

    D20Model(QObject *parent = 0);

    QModelIndex addSkill();
    QModelIndex addSubSkill(const QString& skill);

    QModelIndex addSpecial();
    QModelIndex addFeat();
    QModelIndex addBaseBonus();

    QModelIndex addCharacterClass();


    virtual QModelIndex group(QString name) const;


    template <typename ITEM>
    int createItem(const QString& name, const QModelIndex& parent)
    {
        if (!parent.isValid()) return -1;

        ITEM* item = new ITEM();
        item->setData(AbstractItem::NameData, name);
        return addItem(item, parent);
    }


};

#endif // D20MODEL_H
